package com.scqkxx.gamebox.receiver;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.util.Log;

import com.scqkxx.gamebox.activity.MainActivity;
import com.scqkzqtz.base.library.utils.Base64Utils;


/**
 * Created by zsx on 2018/7/31.
 */

public class IntentPushActivity extends Activity {
    private static final String TAG = "IntentPushActivity";

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        try {
            Intent intent = getIntent();
            Log.e(TAG, intent.getStringExtra("type") + "");
            Log.e(TAG, intent.getStringExtra("payload") + "");
            String payload = Base64Utils.setDecrypt(intent.getStringExtra("payload") + "");
            String typePush = intent.getStringExtra("type") + "";

//            if ("VendorPush".equals(typePush)) {
//                if (!ActivityCollector.isActivityExist(MainActivity.class))
//                    startActivity(new Intent(this, MainActivity.class));
//            }
            Intent intentService = new Intent(this, IntentStartService.class);
            intentService.putExtra("type", typePush);
            intentService.putExtra("payload", payload);
            startService(intentService);
        } catch (Exception e) {

        }
        this.finish();
    }
}
